function getClassList(that) {
    let prefix = 'https://gr.tunnel.qydev.com/demo';
    let session_id = wx.getStorageSync('JSESSIONID');//本地取存储的sessionID
    wx.request({
      url: prefix+'/user/userclass/findMyClass.json',
      method: 'POST', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
      header: {
        'content-type': 'application/x-www-form-urlencoded',
        'Cookie': 'JSESSIONID=' + session_id
      },
      success: function(res){
        console.info(res);
        console.info(res.data.data.resultList);
        that.setData({
          list: res.data.data.resultList,
          showLoading: false
        });

        getInstanceItem(that);
      },
      fail: function(res) {
        // fail
      }
    })
}
function getInstanceItem(that) {
    let classList = that.data.list;
    let studyMomentMap = [NaN, '学前阶段', '学中阶段', '学后阶段'];
    for (let i of classList) {
        console.info(i);
        let itemData = getInstanceItemData();
        i.instance = itemData.length;
        i.studyMoment= studyMomentMap[itemData[0].studyMoment];
        i.instanceItemId=itemData[0].instanceItemId;
    }
    that.setData({
        list:classList
    });
}
function getInstanceItemData() {
    //获取实例数据
    let data = { "data": { "resultList": [{ "personItemState": 1, "operatorId": "admin", "itemState": 2, "operator": "admin", "instanceId": "09c2ed1b-2d8f-11e7-82a3-00ff3542ba06", "answerShowWay": 2, "studyMoment": 1, "resultShowWay": 2, "replyPerson": 0, "instanceItemId": "25a7d2d9-2d8f-11e7-82a3-00ff3542ba06", "itemWay": 1, "replyRate": 0.00, "itemOrder": 1, "beginDate": 1493547950000, "answerWay": 1, "itemType": 1, "itemName": "aaaaaaaaaa" }], "pageSize": -1, "currentPage": 0, "count": 0, "maxPage": 0, "minPage": 1, "firstResult": 0, "pagination": { "count": -1, "page": 0, "pages": 0, "size": 0 }, "queryInstanceCode": "9ae5b6d6-2bfe-11e7-82a3-00ff3542ba06", "queryItemState": [2] }, "message": "", "success": true };
    return data.data.resultList;
}
module.exports = {
    getClassList: getClassList
}